package ee.objectCloner.guice;

import java.util.Set;

import javax.inject.Inject;

import com.google.inject.name.Named;

import ee.objectCloner.CloneAdvisor;
import ee.objectCloner.CustomCloner;
import ee.objectCloner.impl.ObjectClonerImpl;

public class GuiceObjectCloner extends ObjectClonerImpl {

	@Inject
	public <T, S extends T> GuiceObjectCloner(
			@Named("defaultCloner") CustomCloner defaultCloner,
			@Named("customCloners") Set<CustomCloner> customCloners,
			@Named("immutables") Set<Class<?>> immutables,
			@Named("cloneAdvisors") Set<CloneAdvisor> cloneAdvisors) {
		super(defaultCloner);

		for (CustomCloner customCloner : customCloners) {
			addCustomCloner(customCloner);
		}
		
		for (Class<?> type : immutables) {
			addImmutable(type);
		}
		
		for (CloneAdvisor cloneAdvisor : cloneAdvisors) {
			addCloneAdvisor(cloneAdvisor);
		}
	}

}
